/*
 *  Multi2Sim
 *  Copyright (C) 2012  Yifan Sun (yifansun@coe.neu.edu)
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef RUNTIME_HSA_HSA_H
#define RUNTIME_HSA_HSA_H

#include "../include/hsa.h"
#include "../include/hsa_ext_finalize.h"

#define __HSA_RUNTIME_NOT_IMPLEMENTED__ \
		panic("HSA runtime function %s not implemented\n", __FUNCTION__);

// Function code to pass as a first argument of a system call
enum hsa_abi_call_t
{
	hsa_abi_invalid,
#define DEFCALL(name, code, func) name,
#include "../../src/arch/hsa/driver/Driver.def"
#undef DEFCALL
	hsa_abi_call_count
};

// A global data structure
extern struct hsa_runtime_t *hsa_runtime;

// An hsa_runtime is a data structure that holds informations of current
// execution of the runtime
struct hsa_runtime_t
{
	// File descriptor to communicate with the hsa driver
	int fd;
};

/// The global hsa runtime instance
struct hsa_runtime_t *hsa_runtime;

#endif /* RUNTIME_HSA_HSA_H_ */
